﻿#region Đào Mạnh Hòa
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Collections;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace BusinessLogic
{
    public static class SelectSoQuy
    {
        public static Entities.PhieuThu[] PhieuThu()
        {
            ArrayList array = new ArrayList();
            Entities.PhieuThu[] temp = BusinessLogic.PhieuThu.Select();
            if (temp == null)
                return new Entities.PhieuThu[0];
            foreach (Entities.PhieuThu item in temp)
            {
                if (item.Deleted == false)
                    array.Add(item);
            }
            Entities.PhieuThu[] phieuthu = (Entities.PhieuThu[])array.ToArray(typeof(Entities.PhieuThu));
            if (phieuthu == null)
                phieuthu = new Entities.PhieuThu[0];
            return phieuthu;
        }

        public static Entities.PhieuChi[] PhieuChi()
        {
            ArrayList array = new ArrayList();
            Entities.PhieuChi[] temp = BusinessLogic.PhieuChi.Select();
            if (temp == null)
                return new Entities.PhieuChi[0];
            foreach (Entities.PhieuChi item in temp)
            {
                if (item.Deleted == false)
                    array.Add(item);
            }
            Entities.PhieuChi[] phieuchi = (Entities.PhieuChi[])array.ToArray(typeof(Entities.PhieuChi));
            if (phieuchi == null)
                phieuchi = new Entities.PhieuChi[0];
            return phieuchi;
        }

        public static Entities.SoDuSoQuy[] SoDuSoQuy(string makho)
        {
            Entities.SoDuSoQuy[] temp = BusinessLogic.SoQuy.Select(makho);
            if (temp == null)
                temp = new Entities.SoDuSoQuy[0];
            return temp;
        }

        public static Entities.PhieuTTCuaKH[] PhieuTTKH()
        {
            ArrayList array = new ArrayList();
            Entities.PhieuTTCuaKH[] temp = BusinessLogic.PhieuTTKH.Select();
            if (temp == null)
                return new Entities.PhieuTTCuaKH[0];
            return temp;
        }

        public static Entities.PhieuTTNCC[] PhieuTTNCC()
        {
            ArrayList array = new ArrayList();
            Entities.PhieuTTNCC[] temp = BusinessLogic.PhieuTTNCC.Select();
            if (temp == null)
                return new Entities.PhieuTTNCC[0];
            return temp;
        }

        public static Entities.SelectSoQuy Select(string makho)
        {
            try
            {
                Entities.SelectSoQuy temp = new Entities.SelectSoQuy();
                temp.PhieuChi = PhieuChi();
                temp.PhieuThu = PhieuThu();
                temp.SoDuSoQuy = SoDuSoQuy(makho);
                temp.PhieuTTCuaKH = PhieuTTKH();
                temp.PhieuTTNCC = PhieuTTNCC();

                return temp;
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); return new Entities.SelectSoQuy(); }
            finally
            {
            }

        }
    }
}
#endregion